-
Notifications
You must be signed in to change notification settings - Fork 279
chore(ui5-avatar): migrate wdio tests to cypress #11817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -306,3 +306,183 @@ describe("Fallback Logic", () => { | |||
.should("have.class", "ui5-avatar-fallback-icon-hidden"); | |||
}); | |||
}); | |||
|
|||
describe("Avatar", () => { | |||
let sharedInputValue = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should no longer need to track events with inputs, with cypress we can create stubs and assert the stubs directly
Example:
cy.get("@avatar")
.then(avatar => {
avatar.get(0).addEventListener("ui5-click", cy.stub().as("clickStub"));
});
cy.get("@avatar")
.click();
cy.get("@clickStub")
.should("have.been.calledOnce");
beforeEach(() => { | ||
cy.mount( | ||
<div> | ||
<Avatar id="myAvatar1"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defining every avatar in the beforeEach hook is making the test cases harder to read. Instead, define each avatar with its initial state directly in the mount phase of the test where it’s used.
If an avatar is needed across multiple tests, create a generic one with empty or minimal setup in beforeEach, and set its specific state during the test’s setup phase.
Convert Avatar and AvatarGroup tests to Cypress component tests while maintaining test coverage and functionality parity with original specs.
JIRA: BGSOFUIPIRIN-6816